// pages/index/index.js

// import * as echarts from '../../ec-canvas/echarts'
//
import * as echarts from '../../ec-canvas/echarts.min.js'
import { setOption, initChart, } from './setOpts'

// echarts 渲染实例
let ecsInst = []

Page({

  /**
   * 页面的初始数据
   */
  data: {
    userInfo: {
      name: '',
      post: '',
      company: '',
      avatar: '',
    },

    sideNavActive: 0,
    sideNavActive1: 0,

    ztList: [],           // 账套列表
    tmplList: [],         // 模板列表
    assetsList: [],       // 资产列表
    assetsTotal: 0,       // 资产 总资金
    assetsToday: 0,       // 资产 今日收益
    navList: [
      { src: '../../image/index1/chunabiao.png', name: '出纳表', url: '/accounting/cashier_table/cashier_table?entity=all_cashier', },
      { src: '../../image/index1/chakanpingzheng.png', name: '查看凭证', url: '/accounting/accounting_voucher/accounting_voucher?entity=all_voucher', },
      { src: '../../image/index1/kehuxinxi.png', name: '客户信息', url: '/pages/general_entity/general_entity?entity=customer', },
      { src: '../../image/index1/chanpinkucun.png', name: '产品库存', url: '/stock/stock_balance/stock_balance', },
    ],
    sideNavList: [
      { src: '../../image/index/link.png', icon: 'icon-gongsijiagou', name: '公司架构', url: '/pages/company_structure/company_structure?entity=all_department', },
      { src: '../../image/index/link.png', icon: 'icon-yonghuguanli', name: '用户管理', url: '/pages/user_management/user_management?entity=all_user', },
      { src: '../../image/index/link.png', icon: 'icon-yuangongziliao', name: '员工资料', url: '/pages/general_entity/general_entity?entity=all_employee_inf', },
    ],
    // tabActive: -1,

    //230118 yan 修改 左侧导航栏
    tabList:['公司','模板'],
    tabActive: 0,

    appList: [],          // 首页应用列表
    noteList: [],         // 消息通知列表
    chartList: [],        // 报表设置列表
    setShow: false,       // 顶部设置显示
    selectShow: false,    // 报表设置显示
    popShow: false,       // 左侧划出显示

    chartsHide: true,     // 报表列表是否隐藏
    ecsList: [],          // echarts列表
    ecsTableDataObj: {},  // 图表表格数据

    foldHeight: 0,        // 资产面板高度
    isFoldOpen: false,    // 资产面板展开
    search: '',           // 左侧搜索公司input值
    searchTmpl: '',       // 左侧搜索模板input值

    // 图表假数据
    ec: {
      onInit: initChart,
    },
  },

  // 双向绑定 报警告处理
  inputIpt: wx.$util.debounce(function(e) {
    let { ztList, search, tmplList, searchTmpl, tabActive, zhangtaoList,searchZt} = this.data
    if(!tabActive) {  // 公司
      ztList.forEach(item => item.isClose = !(item.company_name.indexOf(search) > -1))
      this.setData({
        ztList,
      })
    }
    else if (tabActive == 1) {    // 模板
      tmplList.forEach(item => item.isClose = !(item.company_name.indexOf(searchTmpl) > -1))
      this.setData({
        tmplList,
      })
    }
    //账套 230119 yan + 账套搜索
    else {
      zhangtaoList.forEach(item => item.isClose = !(item.zt_name.indexOf(searchZt) > -1))
      this.setData({
        zhangtaoList,
      })
    }
  }, 100),

  // 顶部
  // 切换集团
  toggleCompany(e) {
    let { tabActive, sideNavActive, } = this.data,
        obj = {
          popShow: e.currentTarget.dataset.show,
        }
    if(tabActive < 0) obj.tabActive = sideNavActive === null ? 1 : 0
    this.setData(obj)
  },
  // 选择头像 小程序用户头像昵称获取规则调整公告：https://developers.weixin.qq.com/community/develop/doc/00022c683e8a80b29bed2142b56c01
  onChooseAvatar(e) {
    let { avatarUrl } = e.detail,
        { userInfo, } = this.data

    // 小程序选择的图片临时本地路径转为base64
    wx.$util.base64(avatarUrl).then(res => {
      userInfo.avatar = res
      this.setData({
        userInfo,
      })
      wx.setStorageSync('avatar', res)
    })
  },
  onTabChange(e) {
    this.data.tabActive = e.detail.index
  },
  onTabTap(e) {
    let { i, } = e.currentTarget.dataset
    // if(i) {
    //   i = Number(i)
      this.setData({
        tabActive: i,
      })
    // }
  },
  // 设置
  toggleSet(e) {
    this.setData({
      setShow: !this.data.setShow,
    })
  },
  // 应用设置
  setApp(e) {
    console.log('应用设置');
  },
  // 展开收起 资产
  togglePanel(e) {
    let { foldHeight, isFoldOpen } = this.data
    if(foldHeight) {
      this.setData({
        isFoldOpen: !isFoldOpen,
      })
    }
  },
  // nav 跳转
  navTo(e) {
    let url = e.currentTarget.dataset.url
    if(!url) {
      wx.$toast('小程序不支持该功能！')
    } else if(url === 'more') {
      wx.switchTab({
        url: '../workbench/workbench',
      })
    } else {
      wx.navigateTo({
        url,
      })
    }
  },
  // 报表设置 / 关闭
  toggleSelect(e) {
    if(!this.data.chartList.length) return
    this.setData({
      selectShow: e.currentTarget.dataset.show,
    })
  },
  // switch change 报表是否显示在首页(要对接接口还是本地cookie存储？)
  switchChange(e) {
    let d = e.currentTarget.dataset,
        i = d.i,
        chart = d.item,
        chartList = this.data.chartList

    let checkedArr = chartList.filter(item => item.checked)
    if(checkedArr.length === 1 && !e.detail) {
      wx.$toast('首页必须设置一个报表')
      return
    }
    this.updateChartUse(chartList[i].analysis_chart_id, e.detail).then(res => {
      chartList[i].checked = e.detail
      this.setData({
        chartList,
      })
      this.setChartShow(chartList)
      if(e.detail) {  // 重新获取数据
        if(ecsInst[i]) {
          try { // 销毁echarts
            ecsInst[i].dispose()
            ecsInst[i] = ''
          } catch(error) {}
        }
        this.getChartData(chartList[i])
      }
    })
  },
  // 是否全部报表都不显示
  setChartShow(chartList) {
    let showList = chartList.filter(item => item.checked)
    this.setData({
      chartsHide: showList.length ? false : true,
    })
  },
  // 切换账套
  changeZt(e) {
    let db_id = e.currentTarget.dataset.db_id;
    //230118 yan 修改传入请求参数对象
    let post = {
      refresh_token: wx.getStorageSync('refresh'),
      db_id: db_id,
    }
    this.refreshToken(post)
  },




  // 接口
  // 获取账套列表--公司
  getZtList() {
    let data = {
      type: 0,
    }
    wx.$get(3, 'All_company/query_all_company_db', data).then(res => {
      if(res.errcode !== 0) return
      let rows = res.data.row.filter(item => item.db_id),
          system_id = wx.getStorageSync('system_id'),
          sideNavActive = null
      if(system_id) system_id = Number(system_id)
      rows.some((item, i) => {
        if(system_id === item.system_id) {
          sideNavActive = i
          return true
        }
      })
      this.setData({
        ztList: rows,
        sideNavActive,
      })
    })
  },
  // 获取模板列表
  getTmplList() {
    let data = {
      type: 1,
    }
    wx.$get(3, 'All_company/query_all_company_db', data).then(res => {
      if(res.errcode !== 0) return
      let rows = res.data.row.filter(item => item.db_id),
          system_id = wx.getStorageSync('system_id'),
          sideNavActive1 = null
      if(system_id) system_id = Number(system_id)
      rows.some((item, i) => {
        if(system_id === item.system_id) {
          sideNavActive1 = i
          return true
        }
      })
      let obj = {
        tmplList: rows,
        sideNavActive1,
      }
      if(sideNavActive1 !== null) obj.tabActive = 1
      this.setData(obj)
    })
  },
  // // 获取资产列表
  // getAssetsList() {
  //   let post = {
  //     limit: 30,
  //     oby: 'V_all_cashier_balance.row_id desc',
  //     page: 1,
  //     table_id: 'V_all_cashier_balance',
  //   }
  //   wx.$post(3, 'DynamicQuery/query_dynamic_v1', post).then(res => {
  //     if(res.errcode !== 0) return
  //     let rows = res.data.row,
  //         balanceTotal = 0,
  //         balanceToday = 0,
  //         today = wx.$util.formatTime(new Date()).replaceAll('/', '-').split(' ')[0]
  //     today = '2022-07-25'
  //     rows.forEach(item => {
  //       balanceTotal += item.balance
  //       if(item.input_time.indexOf(today) > -1) balanceToday += item.balance
  //       item.balance = item.balance.toFixed(2)
  //     })
  //     this.setData({
  //       assetsList: rows,
  //       assetsTotal: balanceTotal.toFixed(2),
  //       assetsToday: balanceToday.toFixed(2),
  //     })
  //     let query = wx.createSelectorQuery()
  //     query.select('.toggle').boundingClientRect(rect => {
  //       this.setData({
  //         foldHeight: rect.height * 2,
  //       })
  //     }).exec()
  //   })
  // },
  // 获取资产列表
  getAssetsList() {
    let post0 = {
      system_id: 0,
      user_id: '',
      user_name: '',
    }
    // 出纳账户余额详细查询
    wx.$post(3, 'Cashier/query_all_cashier_balance', post0).then(res => {
      if(res.errcode !== 0) return
      let rows = res.data.row
      rows.forEach(item => item.balance = item.balance.toFixed(2))
      this.setData({
        assetsList: rows,
      })
      let query = wx.createSelectorQuery()
      query.select('.toggle').boundingClientRect(rect => {
        this.setData({
          foldHeight: rect.height * 2,
        })
      }).exec()
    })

    let post1 = {
      system_id: 0,
      user_id: '',
      user_name: '',
    }
    // 总资金、今日余额
    wx.$post(3, 'Cashier/query_all_cashier_custom', post1).then(res => {
      if(res.errcode !== 0) return
      let row = res.data.row[0]
      this.setData({
        assetsTotal: row.balance_all.toFixed(2),
        assetsToday: row.amount_today.toFixed(2),
      })
    })
  },
  // 获取首页应用列表
  getAppList() {
    // wx.$fakeReq((t) => {
    //   console.log(t, '获取首页应用列表');
    //   this.setData({
    //     appList: [
    //       { src: '../../image/index/app0.png', name: '打卡', url: '', },
    //       { src: '../../image/index/app1.png', name: '考勤', url: '', },
    //       { src: '../../image/index/app2.png', name: '审批', url: '', },
    //       { src: '../../image/index/app3.png', name: '任务', url: '', },
    //       { src: '../../image/index/app4.png', name: '日程', url: '', },
    //       { src: '../../image/index/app5.png', name: '会议室', url: '', },
    //       { src: '../../image/index/app6.png', name: '汇报', url: '', },
    //       { src: '../../image/index/app7.png', name: '跟进', url: '', },
    //       { src: '../../image/index/app8.png', name: '@我的', url: '', },
    //       { src: '../../image/index/app9.png', name: '更多', url: '', },
    //     ],
    //   })
    // })
    wx.$post(3, 'Menu/query_menu_person_qx', {}).then(res => {
      if(res.errcode !== 0) return
      let rows = res.data.row

      // 221118 如果rows是空数组，设置默认显示菜单
      if(!rows.length) {
        rows = [
          {
            menuId: 32,
            menuName: '新增凭证',
            menuLabel: '新增凭证',
            menuURL: './pages/accounting/edit_voucher.html?entity=new_all_voucher&table_id=all_voucher&type=new',
            menuIcon: '../../image/workbench1/xinzengpingzheng.png',
            parentId: 3,
            sort: 0,
            table_id: 'all_voucher',
            miniprogram_icon_url: '',
            children: null,
          },
          {
            menuId: 152,
            menuName: '商品定义',
            menuLabel: '商品',
            menuURL: './pages/inventory_management/product_list.html?entity=goods',
            menuIcon: '../../image/workbench1/shangpindingyi.png',
            parentId: 15,
            sort: 1,
            table_id: 'goods',
            miniprogram_icon_url: '',
            children: null,
          },
          {
            menuId: 1510,
            menuName: 'BOM表',
            menuLabel: 'BOM表',
            menuURL: './pages/inventory_management/bom.html?entity=bom',
            menuIcon: '../../image/workbench1/bombiao.png',
            parentId: 15,
            sort: 3,
            table_id: 'bom',
            miniprogram_icon_url: '',
            children: null,
          },
          {
            menuId: 26,
            menuName: '员工管理',
            menuLabel: '员工管理',
            menuURL: './pages/general_entity/show_entity.html?entity=all_employee_inf',
            menuIcon: '../../image/workbench1/app_dflt.png',
            parentId: 2,
            sort: 4,
            table_id: 'all_employee_inf',
            miniprogram_icon_url: '',
            children: null,
          },
          {
            menuId: 23,
            menuName: '用户管理',
            menuLabel: '用户管理',
            menuURL: './pages/user_management/user_management.html?entity=all_user',
            menuIcon: '../../image/workbench1/yonghuguanli.png',
            parentId: 2,
            sort: 5,
            table_id: 'all_user',
            miniprogram_icon_url: '',
            children: null,
          },

          {
            menuId: 37,
            menuName: '科目明细账',
            menuLabel: '科目明细账',
            menuURL: './pages/accounting/subject_detail.html?entity=all_voucher_statistics',
            menuIcon: '../../image/workbench1/mingxizhang.png',
            parentId: 3,
            sort: 6,
            table_id: 'all_voucher_statistics',
            miniprogram_icon_url: '',
            children: null,
          },
          {
            menuId: 161,
            menuName: '固定资产',
            menuLabel: '固定资产总表',
            menuURL: './pages/general_entity/show_entity.html?entity=e_gudingzichan',
            menuIcon: '../../image/workbench1/app_dflt.png',
            parentId: 16,
            sort: 7,
            table_id: 'e_gudingzichan',
            miniprogram_icon_url: '',
            children: null,
          },
          {
            menuId: 162,
            menuName: '折旧表',
            menuLabel: '折旧表',
            menuURL: './pages/general_entity/show_entity.html?entity=e_zhejiubiao',
            menuIcon: '../../image/workbench1/app_dflt.png',
            parentId: 16,
            sort: 8,
            table_id: 'e_zhejiubiao',
            miniprogram_icon_url: '',
            children: null,
          },
        ]
      }
      wx.$parseUrl(rows)
      rows.sort((a, b) => a.sort - b.sort)
      rows.push({ menuName: '更多', menuLabel: '更多', menuURL: 'more', wxMenuURL: 'more', menuIcon: '../../image/workbench1/gengduo.png', },)
      rows.forEach(item => {
        item.url = item.menuURL
        item.name = item.menuLabel
        let src = item.menuIcon
        item.src = src
      })
      this.setData({
        appList: rows,
      })
    })
  },
  // 获取消息通知列表
  getNoteList() {
    wx.$fakeReq((t) => {
      console.log(t, '获取消息通知列表');
      this.setData({
        noteList: [
          { src: '../../image/index/note.png', content: '在挂起任务时，JS 引擎会将所有任务按照类别分到这两个队列中，首先在 ma', date: '2021-11-23 15:11', },
          { src: '../../image/index/note.png', content: '以下文件体积超过 500KB,已跳过压缩以及 ES6 转 ES5 的处理', date: '2021-11-20 12:11', },
          { src: '../../image/index/note.png', content: '在使用这个组件开发页面的时的橡皮筋效果时', date: '2021-11-11 17:11', },
        ],
      })
    })
  },
  // 获取报表设置列表
  getChartList() {
    let p0 = this.getAllChartList(),
        p1 = this.getUsedChartList()
    Promise.all([p0, p1]).then(res => {
      let allList = res[0],
          usedList = res[1],
          ecsList = []
      if(allList.length && !usedList.length) {  // 首页没有设置图表，默认打开第一个图表
        let item = JSON.parse(JSON.stringify(allList[0]))
        usedList.push(item)
      }

      let usedObj = {}
      usedList.forEach(item => usedObj[item.analysis_chart_id] = item)
      allList.forEach((item, i) => {
        item.checked = usedObj[item.analysis_chart_id] ? true : false
        if(item.checked) this.getChartData(item)
        item.i = i
        // 是否为图表
        item.isChart = !['table', ].includes(item.component_type)
        ecsList.push({
          chart: item,
          ec: {
            lazyLoad: true,
          },
        })
        ecsInst.push('')
      })
      this.setData({
        chartList: allList,
        ecsList,
      })
      this.setChartShow(allList)
    })
  },
  getUsedChartList() {
    let post = {
      system_id: 800,
      user_id: wx.getStorageSync('user_id'),
      user_name: '',
      is_used: true,
    }
    return new Promise((resolve, reject) => {
      wx.$post(3, 'All_analysis_chart/query_all_analysis_chart_person', post).then(res => {
        if(res.errcode !== 0) return
        let rows = res.data.row.filter(item => item.component_type !== 'number'),
            ecsList = []
        resolve(rows)
      })
    })

  },
  getAllChartList() {
    let post = {
      limit: 0,
      oby: 'analysis_chart_id',
      page: 1,
    }
    return new Promise((resolve, reject) => {
      wx.$post(3, 'All_analysis_chart/query_all_analysis_chart', post).then(res => {
        if(res.errcode !== 0) return
        let rows = res.data.row.filter(item => item.component_type !== 'number')
        resolve(rows)
      })
    })
  },
  // 获取报表数据
  getChartData(chart) {
    let post = {
      analysis_chart_id: chart.analysis_chart_id,
      system_id: wx.getStorageSync('system_id'),
      time_group_id: 1,
    }
    wx.$post(3, 'All_analysis_chart/query_analysis_chart_data', post).then(res => {
      if(res.errcode !== 0) return
      let rows = res.data.row[0].Data,
          type = chart.component_type,
          xData = [],
          yData = [],
          width = []

      if(type === 'ranking') {
        rows.sort((a, b) => chart.is_desc ? b.tatolvalue - a.tatolvalue : a.tatolvalue - b.tatolvalue)
        type = 'line'
      }

      // 处理数据
      if(type === 'pie') {  // 饼图
        rows.forEach(item => yData.push({ value: item.tatolvalue || 0, name: item.linkname, }))
      } else if(['line', 'bar', ].includes(type)) {   // 折线图/柱状图
        let isStack = type === 'bar' && chart.classify_tier === '3',  // 堆叠柱状图
            baseObj = {
              label: {
                show: true,
                position: 'top',
                fontSize: 10,
              }
            },
            seriesNameArr = []
        if(type === 'line') baseObj.smooth = true
        else if(isStack) baseObj.stack = 'Ad'

        rows.forEach((item, i) => {
          if(!i) {
            seriesNameArr = Object.keys(item).filter(key => !['linkname', 'tatolvalue', 'field_value'].includes(key) && item[key] !== item.field_value)
            let xName = Object.keys(item).filter(key => !['linkname', 'tatolvalue', 'field_value'].includes(key) && item[key] === item.field_value)[0]
            chart.xName = xName
            seriesNameArr.forEach(name => {
              yData.push({
                name,
                type,
                data: [],
                ...baseObj,
              })
            })
          }
          xData.push(item.linkname)
          yData.forEach(ydata => {
            let { name, data, } = ydata
            data.push(item[name] || 0)
          })
        })
      } else if(type === 'table') { // 表格
        rows.forEach((item, i) => {
          if(!i) {
            Object.keys(item).forEach(key => {
              if(!['field_value', 'linkname', 'tatolvalue'].includes(key)) {
                item[key] === item.field_value ? xData.unshift(key) : xData.push(key)
                width.push(key.length + 2)
              }
            })
          }

          let push = []
          xData.forEach((key, i) => {
            let val = (i ? item[key] : item.linkname) || 0
            push.push(val)

            let len = (val + '').length
            if(!isNaN(val)) {
              len = len * 0.6 + 2
            } else {
              val += ''
              val = val.replaceAll(/\d|\.|-/ig, '')
              val = val.replaceAll(/[a-z]/g, '')
              len = val.length + (len - val.length) * 0.6 + 2
            }
            len = Math.round(len)
            if(width[i] < len) width[i] = len
          })
          yData.push(push)
        })
      }

      if(chart.component_type === 'ranking' || type === 'table') {
        let ecsTableDataObj = this.data.ecsTableDataObj
        ecsTableDataObj[chart.analysis_chart_id] = {
          x: xData,
          y: type === 'table' ? yData : yData[0].data,
          width,
        }
        this.setData({
          ecsTableDataObj,
        })
      }
      if(['pie', 'bar', 'line', ].includes(type)) this.initChart(chart, yData, xData)
    })
  },
  initChart(item, yData, xData) {
    let ecComp = this.selectComponent('#mychart' + item.i)
    ecComp.init((canvas, width, height, dpr) => {
      let chart = echarts.init(canvas, null, {
        width,
        height,
        devicePixelRatio: dpr,    // new
      })
      canvas.setChart(chart)

      let option = setOption(item, yData, xData)
      chart.setOption(option)

      ecsInst[item.i] = chart

      return chart
    })
  },
  // 切换账套
  refreshToken(post,id) {
    /*let post = {
      refresh_token: wx.getStorageSync('refresh'),
      db_id: id,
    }*/
    wx.$post(1, 'Authorize/RefreshToken', post).then(res => {
      if(res.errcode !== 0) return;
      //230118 yan 判断系统是否有账套
      let data = res.data.row[0] || {};
      wx.$util.setLoginStorage(res.data.row[0])
      wx.$getBarTitle(data.system_id);
      wx.reLaunch({
        url: '../index/index',
      })
      // wx.switchTab({
      //   url: '../index/index',
      // })
    })
  },
  // 更改个人首页图表使用标识
  updateChartUse(chartId, checked) {
    let post = {
      system_id: 0,
      user_id: wx.getStorageSync('user_id'),
      user_name: wx.getStorageSync('user_name'),
      analysis_chart_id: chartId,
      is_used: checked,
    }
    return new Promise((resolve, reject) => {
      wx.showLoading({ mask: true, })
      wx.$post(3, 'All_analysis_chart/update_all_analysis_chart_person', post).then(res => {
        wx.hideLoading()
        if(res.errcode !== 0) return
        wx.$toast(res.errmsg)
        resolve()
      })
    })
  },

  //230119 yan 增加设置账套
  setZhangtao(){
    let is_zt = wx.getStorageSync('is_zt'),
      {tabList} = this.data;
    if (is_zt) {
      this.getZhangtaoList();
      tabList.push('账套');
      this.setData({tabList})
    }
  },

  //230118 yan 增加 获取账套列表
  getZhangtaoList(){
    wx.$post(1,'AccountSet/select_zt',{}).then(res=>{
      if(res.errcode !== 0) return;
      let rows = [{zt_id: 'is_all_zt',zt_name: '全部账套'},...res.data.row],
        zt_id = wx.getStorageSync('zt_id'),
        is_all_zt = wx.getStorageSync('is_all_zt'),
        sideNavActive2 = null,
        zt_name;
      rows.some((item, i) => {
        if (is_all_zt){
          sideNavActive2 = 0;
          zt_name = '全部账套';
          return true
        }
        if(zt_id == item.zt_id) {
          sideNavActive2 = i;
          zt_name = item.zt_name;
          return true
        }
      });


      let obj = {
        zhangtaoList: rows,
        sideNavActive2,
        // ['userInfo.zt_name']: zt_name
      };
      this.setData(obj)
    })
  },

  //切换账套 230118 yan 增加切换账套
  chooseZT(e){
    let ztid = e.currentTarget.dataset.zt_id,
      post = {
        "refresh_token": wx.getStorageSync('refresh'),
        "system_id": wx.getStorageSync('system_id'),
        "zt_id": ztid,
        "is_all_zt": false
      };
    if (ztid === 'is_all_zt') {
      post.is_all_zt = true;
      post.zt_id = wx.getStorageSync('zt_id');
    }
    this.refreshToken(post)
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad(options) {
    wx.$setBarTitle();
    this.getZtList()
    this.getTmplList()
    this.getAssetsList()
    // this.getAppList()
    // this.getNoteList()
    this.getChartList()

    //230119 yan 增加获取切换账套
    this.setZhangtao();

  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady() {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow() {
    let is_all_zt = wx.getStorageSync('is_all_zt'),
      zt_name = wx.getStorageSync('zt_name');
    zt_name = is_all_zt ? '全部账套': (zt_name || '');
    this.setData({
      userInfo: {
        name: wx.getStorageSync('user_name') || wx.getStorageSync('user_id'),
        post: '',
        company: wx.getStorageSync('company_name'),
        avatar: wx.getStorageSync('avatar'),
        zt_name
      }
    })
    // 221114 重新获取资产列表数据
    this.getAssetsList()

    this.getAppList()
  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide() {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload() {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh() {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom() {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage() {

  },
})
